package day08;

import java.util.Scanner;

/**
 * @author Xiao
 * @date 2021/7/9
 */
public class printString {
    /**
     *      遍历字符串：
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String s = sc.nextLine();
        System.out.println("-------------");
        for (int i = 0; i < s.length(); i++) {
            System.out.print(s.charAt(i) + "\t");
        }
        System.out.println();
        System.out.println("-----------");
        char[] ch = s.toCharArray();
        for (int i = 0; i < ch.length; i++) {
            System.out.print(ch[i] + "\t");
        }
        System.out.println();
    }
}
